package com.peza.bikelog.gui.views;

import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
import com.vaadin.ui.Layout;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;

@SuppressWarnings("serial")
public abstract class AbstractView extends VerticalLayout{
	
	
	protected AbstractView(){
		super();
		defineEvents();
	}
	
	private void defineEvents(){
		
		
	}
	
	protected void openNotImplemented(){
		openInfo("Feel free to implement this yourself...");
	}
	
	protected void openInfo(String info){
		Window subWindow = new Window("Info");
		VerticalLayout subContent = new VerticalLayout();
		subContent.setMargin(true);
		subWindow.setContent(subContent);
		subContent.addComponent(new Label(info));
		subWindow.center();
		UI.getCurrent().addWindow(subWindow);
	}
	
	
	protected void openWindow(Layout layout, String windowTitle){
		Window subWindow = new Window(windowTitle);
		subWindow.setContent(layout);
		subWindow.center();
		UI.getCurrent().addWindow(subWindow);
		
	}
	

	

}
